home *** CD-ROM | disk | FTP | other *** search
/ The Best of MacTutor - S…e Code for Volumes 1 to 5 / The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin / Source Code / #46 (Jul 89) / Basic Source / GETRESWINDOW.S < prev    next >
Text File  |  1989-05-17  |  1KB  |  40 lines

  1. 'V
  2. 'S
  3. 'GETRESWINDOW function By Charles Stricklin
  4. 'Modified by Dave Kelly for MacTutor, May, 1989
  5.  
  6. 'This function creates a ZBasic window from a window template
  7. 'resource.  The result given is boolean;true if task is accomplished,
  8. 'false if there's a problem (i.e. resource doesn't exist, etc.)
  9.  
  10. ' resourceID is the resource ID of the window template to be used.
  11. ' windowNumber is the ZBasic number of the window to be created.
  12. ' modal is boolean.
  13.  
  14. LONG FN GETRESWINDOW(ResourceID, WindowNumber, Modal)
  15.     Done=0
  16.     Title$=""
  17.     FALSE=0
  18.     MyHandle&=FN GETRESOURCE(CVI("WIND"),ResourceID)
  19.     LONG IF FN RESERROR=FALSE
  20.         MyPointer&=USR 3(MyHandle&)
  21.         Y1=PEEK WORD(MyPointer&)
  22.         X1=PEEK WORD(MyPointer&+2)
  23.         Y2=PEEK WORD(MyPointer&+4)
  24.         X2=PEEK WORD(MyPointer&+6)
  25.         Type=PEEK WORD(MyPointer&+8)+1
  26.         HasClose=PEEK WORD(MyPointer&+12)
  27.         LengthOfTitle=PEEK(MyPointer&+18)
  28.         FOR Character=1 TO LengthOfTitle
  29.             Title$=Title$+CHR$(PEEK(MyPointer&+18+Character))
  30.         NEXT
  31.         IF Type=13 THEN Type=9: 'ZBasic doesn't support ZoomNoGrow
  32.         IF HasClose=FALSE THEN Type=Type+256
  33.         IF Modal THEN Type=-Type
  34.         WINDOW WindowNumber,Title$,(X1,Y1)-(X2,Y2),Type
  35.         Done=-1
  36.     END IF
  37.     MyHandle&=USR 7(MyPointer&)
  38.     CALL DETACHRESOURCE(MyHandle&)
  39. END FN=Done
  40.